﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Vici.Mvc;
using Vici.CoolStorage;
using Vici.Core;
namespace web._Initialize
{
    public class Main
    {
        public static void Init()
        {
            //Ajax 框架
            WebAppConfig.AjaxProvider = new JQueryAjaxProvider();
            //Session 类型
            WebAppConfig.SessionType = typeof(ClientSession);
            //创建默认路由器
            WebAppConfig.Router.AddDefaultRoutes("");
            //创建对象转换器
            WebAppConfig.RegisterCustomObjectCreator(new DataCreateObject());
            //添加路由器
            Route route = new Route("index/{id}", "index");
            route.AddValidator(new RegexRouteValidator("id", @"\d+", RouteValidationAction.Error, RouteValidationAction.Error));
            WebAppConfig.Router.AddRoute(route);
            //   Vici.CoolStorage.CSConfig.SetDB(new Vici.CoolStorage.CSDataProviderSqlServer("Data Source=.;Initial Catalog=web2012;Integrated Security=True"));
        }
    }
}